package com.date;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.junit.Test;
 
public class DateTest {
	
	//全局变量
	Date d=new Date();
	

	@Test
	public void getToday(){
	 System.out.println(d);
	}
	
	@Test
	public void getWeek(){
		Calendar c=Calendar.getInstance();
		c.setTime(d);
		int weekday =c.get(Calendar.DAY_OF_WEEK);
		System.out.println(weekday-1);
	}
	
	@Test
	public void getYMD(){
		SimpleDateFormat s=new SimpleDateFormat("yy-MM-dd hh:mm:ss");
		String today=s.format(d);
		System.out.println(today);
		
	}
	

}
